import GraphBack from '../../src'
function draw() {
  document.querySelectorAll('.graph-background').forEach((ele) => drawBackground(ele))
}
window.addEventListener('resize', () => draw())

function drawBackground(ele) {
  const board = new GraphBack.Board(ele, { create: true })
  const rect = new GraphBack.Rect({
    x: 10,
    y: 10,
    width: board.width - 20,
    height: board.height - 20,
    fill: false
  })
  const box = rect.getBoundBox()
  const lineGradient = new GraphBack.LineGradient(box.left, box.top, box.right, box.bottom)
  lineGradient.add(0, '#84e4ff')
  lineGradient.add(1, '#235fa7')
  rect.option.color = lineGradient
  board.add(rect)
  board.render()
}
